#include<cstdio>
#include<algorithm>
using namespace std;

int main()
{
	int k2,k3,k5,k6,m,sum=0,i;
	scanf("%d%d%d%d",&k2,&k3,&k5,&k6);
	m=min(min(k2,k5),k6);
	sum+=m*256;
	k2-=m;
	m=min(k2,k3);
	sum+=m*32;
	printf("%d\n",sum);
	return 0;
}
